{extend name='common@layout/base' /}
{block name='breadcrumb'}{/block}
{block name='content'}
<script src="/old/shop/resource/js/search_goods.js?{$Think.config.version_source}"></script>
<link href="/old/shop/templates/new20160622/css/layout.css?{$Think.config.version_source}" rel="stylesheet" type="text/css">
<style type="text/css">
body {
_behavior: url(/old/shop/templates/new20160622/css/csshover.htc);
}
.store_index_title .active{
	color: #000;
	border-bottom: 4px solid #EC5171;
}
.store_index_title a{
	color: #666;
	text-decoration: none;
}
.new_page{
	padding: 8px 13px 8px 12px;
}
.new_page .active{
	color: rgb(74,110,156);
}

.nch-sortbar-array li.selected {
	background-color: #EC5171 !important;
	color: white !important;
}

.nch-sortbar-array li.selected a {
	color: white !important;
}

.nch-sortbar-array li.selected:hover a {
	color: white !important;
}

.nch-sortbar-array li:hover a {
	color: #EC5171 !important;
}

.new_arrow_2{
    font-size: 0px;
    line-height: 0;
    vertical-align: middle;
    display: inline-block;
    width: 0px;
    height: 0px;
    border-width: 4px;
    border-color: #777 transparent transparent transparent;
    border-style: solid dashed dashed dashed;
    -webkit-transition: .2s ease-in;
    -moz-transition: -webkit-transform .2s ease-in;
    -o-transition: -webkit-transform .2s ease-in;
    transition: .2s ease-in;	
}
.new_city_select_all_div{
	position: relative;
	z-index: 1000;
	box-sizing: border-box;
}
.new_city_select_result_div{
	border: 1px solid #EEEEEE;
	border-bottom: none;
	background: white;
	padding: 4px;
	position: relative;
	z-index: 3000;
}
.new_city_select_div{
	z-index: 2000;
	position: absolute;
	top: 28px;
	left: -30px;
	background: white;
	width: 400px;
	box-sizing: border-box;
	padding: 16px;
	border: 1px solid #EEEEEE;
    -moz-box-shadow: 0 0 5px #ddd;
    -webkit-box-shadow: 0 0 5px #ddd;
    box-shadow: 0 0 5px #ddd;	
    display: none;
}
.new_city_select_close_div{
	position: absolute;
	top: -10px;
	right: -10px;
	width: 20px;
	height: 28.3px;
}
.new_city_select_div_tab{
	position: relative;
	z-index: 1000;
}
.new_city_select_div_tab_one,
.new_city_select_div_tab_two,
.new_city_select_div_tab_three{
	border: 1px solid #EEEEEE;
	border-bottom: none;
	margin-left: 4px;
	margin-right: 4px;
	padding: 6px;
	font-size: 14px;
	box-sizing: border-box;
	color: #005aa0;
	font-weight: 500;
}
.new_city_select_div_tab_one.active,
.new_city_select_div_tab_two.active,
.new_city_select_div_tab_three.active{
	border: 1px solid  #edd28b;
	border-bottom: 2px solid white;
}
.new_city_select_line_div{
	width: 360px;
	height: 2px;
	background:  #edd28b;
	position: absolute;
	top: 49px;
	left:20px;
	z-index: -1;
	box-sizing: border-box;
}
.new_city_select_div_content{
	padding: 6px;
	padding-left: 16px;
}
.new_city_select_div_content_one,
.new_city_select_div_content_two,
.new_city_select_div_content_three{
	width: 100%;
	text-align: left;
	display: none;
}
.new_city_select_div_content_one.active,
.new_city_select_div_content_two.active,
.new_city_select_div_content_three.active{
	display: block;
}
.new_city_select_div_content_one a,
.new_city_select_div_content_two a,
.new_city_select_div_content_three a{
	display: inline-block;
	color: #005ea7;
	text-decoration: none;
	padding: 4px;
	font-size: 12px;
}
.new_city_select_div_content_one a:hover,
.new_city_select_div_content_two a:hover,
.new_city_select_div_content_three a:hover{
	background: #005ea7;
	color: white;
	text-decoration: none;
}
.new_city_select_div_content_two,
.new_city_select_div_content_three{
	display: none;
}


</style>
{if(isset($slide) || isset($default_slide))}
<div class="bfc">
  <div class="ncs-main">
    <div class="flexslider" style="min-height: 440px;max-height: 440px;overflow:hidden;">
      <ul class="slides">
        {if(isset($slide) && is_array($slide))}
	        {for start='1' end='5'}
		        {if($slide[$i])}
		        <li style="text-align: center;max-width: 1920px;max-height: 440px;"><a <?php if($slide_url[$i] != '' && $slide_url[$i] != 'http://'){ ?> href="<?php echo $slide_url[$i];?>" <?php }?> >
		        <img alt="店铺大图"  src="{$slide[$i]|img_url}"></a></li>
		        {/if}
	        {/for}
        {else /}
            {foreach($default_slide as $key => $val)}
            <li style="text-align: center;max-width: 1920px;max-height: 440px;"><img alt="{$val.name}" src="{$val.image|img_url}"></li>
            {/foreach}
        {/if}
      </ul>
    </div>
  </div>
</div>
{/if}
<script type="text/javascript" src="/old/data/resource/js/jquery.flexslider-min.js"></script> 

<script type="text/javascript">
	$(document).ready(function() {
		
		$('.flexslider').flexslider(
			{
				directionNav: false,
				controlNav: false,
			}
		);  

	    $('.goods-thumb-scroll-show').find('a').mouseover(function(){
	        $(this).parents('li:first').addClass('selected').siblings().removeClass('selected');
	        var _src = $(this).find('img').attr('src');
	        _src = _src.replace('_60.', '_240.');
	        $(this).parents('dt').find('.goods-thumb').find('img').attr('src', _src);
	    });
	});
</script>
<div class="new_w100_ new_h100_ bfc">
<div class="nch-container wrapper">
	
	<div class="new_w100_ new_bg_gray new_h50 store_index_title">
		<a href="{:url('index/store/index',['store_id'=>$store_id])}" class="pull-left new_w100 new_h30 text_center new_inline-block active new_pt16">
			<span class="f15">店铺首页</span>
		</a>
		<a href="{:url('index/store/info',['store_id'=>$store_id])}" class="pull-left new_w100 new_h30 text_center new_inline-block new_pt16">
			<span class="f15">店铺介绍</span>
		</a>
	</div>
	
  	<script src="/old/shop/resource/js/search_goods.js?{$Think.config.version_source}"></script>
	<link href="/old/shop/templates/new20160622/css/layout.css?{$Think.config.version_source}" rel="stylesheet" type="text/css">
	<div class="new_w100_ store_index">
		<div class="left pull-left new_mt20" style="width: 208px;">
		    <div class="nch-module nch-module-style02">
		      <div class="content">
		        <ul id="files" class="tree">
		          <li >
		          	<i class="tree-parent tree-parent-collapsed"></i>
		          	<a href="{:url('index/store/index',['store_id'=>$store_id])}" >全部商品</a>
		            <ul>
		              {foreach($store_gc_class as $v )} 
		              <?php $arr_tmp = array('store_id'=>$store_id,'cate_id'=>$v['id']); 
		              		if($return_area_id){ $arr_tmp['area_id'] = $return_area_id;}
		              ?>
		              <li aria-expanded="true"><i class="tree-parent "></i><a href="{:url('index/store/index',$arr_tmp)}" <?php if( $default_classid == $v['id']){ echo 'class="selected"'; }?> ><?php echo $v['name'] ?></a>
		                <ul>
		                	{foreach( $v['_child'] as $c )} 
		                	<?php $arr_tmp = array('store_id'=>$store_id,'cate_id'=>$c['id']); 
		              			if($return_area_id){ $arr_tmp['area_id'] = $return_area_id;}
		             		?>
		                  	<li class="tree-parent "><i></i><a href="{:url('index/store/index',$arr_tmp)}" <?php if( $default_classid == $c['id']){ echo 'class="selected"'; }?> ><?php echo $c['name'] ?></a></li>
		                	{/foreach}
		                </ul>
		              </li>
		              {/foreach}
		            </ul>
		          </li>
		        </ul>
		      </div>
		    </div>
		</div>
	
  	<div class="right new_mt20">
    <div class="shop_con_list" id="main-nav-holder">
      <nav class="sort-bar" id="main-nav" style="height: 38px; background: #FFFFFF;border: 1px solid #E6E6E6;border-left: none !important;">
        <div class="nch-sortbar-array" style="padding: 0 !important;">
          <ul>
	            <li {if($search_key == 0)} class="selected" {/if}><a href="{:url('index/store/index',array_merge($query, ['key' => '0', 'order' => '0', 'curpage'=>1]))}"  title="默认排序">默认</a></li>
	            <li {if($search_key == 1)} class="selected" {/if}><a href="{if($search_order == '2' && $search_key == '1')}{:url('index/store/index',array_merge($query, ['key' => '1', 'order' => '1', 'curpage'=>1]))}{else /}{:url('index/store/index',array_merge($query, ['key' => '1', 'order' => '2', 'curpage'=>1]))}{/if}" {if($search_key == 1)}class="{$search_order==1 ? 'asc' : 'desc'}"{/if} title="{if($search_order == 2 && $search_key == 1)}点击按销量从低到高排序{else /}点击按销量从高到低排序{/if}">销量<i></i></a></li>
	            <li {if($search_key == 2)} class="selected" {/if}><a href="{if($search_order == '2' && $search_key == '2')}{:url('index/store/index',array_merge($query, ['key' => '2', 'order' => '1', 'curpage'=>1]))}{else /}{:url('index/store/index',array_merge($query, ['key' => '2', 'order' => '2', 'curpage'=>1]))}{/if}" {if($search_key == 2)}class="{$search_order==1 ? 'asc' : 'desc'}"{/if} title="{if($search_order == 2 && $search_key == 2)}点击按人气从低到高排序{else /}点击按人气从高到低排序{/if}">人气<i></i></a></li>
	            <li {if($search_key == 3)} class="selected" {/if}><a href="{if($search_order == '2' && $search_key == '3')}{:url('index/store/index',array_merge($query,['key' => '3', 'order' => '1', 'curpage'=>1]))}{else /}{:url('index/store/index',array_merge($query, ['key' => '3', 'order' => '2', 'curpage'=>1]))}{/if}" {if($search_key == 3)}class="{$search_order==1 ? 'asc' : 'desc'}"{/if} title="{if($search_order == 2 && $search_key == 3)}点击按价格从低到高排序{else /}点击按价格从高到低排序{/if}">价格<i></i></a></li>
	         </ul>
        </div>
       
        
        <div class="new_w130 new_h40 new_inline-block new_pt10" style="padding-left: 470px;">
        	<div class="new_type_div_item three">
				<div class="new_type_div_item_other">
					<div class="new_city_select_all_div" id="new_city_select_all_div">
						<div class="new_city_select_result_div">
							<font id="new_city_select_result">点击选择地区</font>
							<font><i class="new_arrow_2"></i></font>
						</div>
						<div class="new_city_select_div" id="new_city_select_div">
							<img src="/old/shop/templates/new20160622/images/shop/new_close_btn.png" id="new_city_select_close_div" class="new_city_select_close_div" />
							<div class="new_city_select_div_tab new_bfc">
								<div class="new_city_select_div_tab_one new_pull_left new_city_select_div_tab_item active" id="new_city_select_div_tab_one">
									<font id="new_city_selct_div_tab_one_font">请选择</font>
									<font><i class="new_arrow_2"></i></font>
								</div>
								<div class="new_city_select_div_tab_two new_pull_left new_city_select_div_tab_item" id="new_city_select_div_tab_two">
									<font id="new_city_selct_div_tab_two_font">请选择</font>
									<font><i class="new_arrow_2"></i></font>								
								</div>
								<div class="new_city_select_div_tab_three new_pull_left new_city_select_div_tab_item" id="new_city_select_div_tab_three">
									<font id="new_city_selct_div_tab_three_font">请选择</font>
									<font><i class="new_arrow_2"></i></font>								
								</div>
							</div>
							<div class="new_city_select_line_div"></div>
							<div class="new_city_select_div_content new_bfc">
								<div class="new_city_select_div_content_one new_bfc new_pull_left active" id="new_city_select_div_content_one">
								</div>
								<div class="new_city_select_div_content_two new_bfc new_pull_left" id="new_city_select_div_content_two">
								</div>
								<div class="new_city_select_div_content_three new_bfc new_pull_left" id="new_city_select_div_content_three">
								</div>														
							</div>
						</div>						
					</div>
					

				</div>
			</div>
        </div>
        <div class="new_pull_right new_page">
	        	共{$total_num}件商品
	      </div>
      </nav>
	
      <div>
        {include file="index@store/goods_squares"}
      </div>
      <div class="tc mt20 mb20">
        <div class="pagination"> {$page->render()}</div>
      </div>
    </div>
   </div>
  </div>
</div>
</div>
<script>
				(function(){
					
					var list_area = eval({$list_area}),
						return_area_id = {$return_area_id},
						one_select_id = '', 
						two_select_id = '',
						three_select_id = '', 
						obj = {
							'area_id':'', 
							'area_name':'', 
							'area_parent_id':'', 
							'area_sort':'', 
							'area_deep':'' 
						},
						one_list_area = [],
						two_list_area = [],
						three_list_area = [],
						is_clicked = false,
						get_view_html = function(list,flag){
							var content_html = '';
							for(var i=0;i<list.length;i++){
								var is_do = false;
								switch (flag){
									case '1':
										is_do = true; 
										break;
									case '2':
										if(list[i].area_parent_id == one_select_id){
											is_do = true;
										}
										break;
									case '3':
										if(list[i].area_parent_id == two_select_id){
											is_do = true;
										}									
										break;																				
									default:
										break;
								}
								if(is_do == false){
									continue;
								}
								content_html+='<div class="new_pull_left new_w25_ new_pt4 new_pb4 new_city_select_div_content_item" data-area-id="'
									+list[i].area_id+'" data-area-name="'+list[i].area_name
									+'" data-area-parent-id="'+list[i].area_parent_id
									+'" data-area-sort="'+list[i].area_sort
									+'" data-area-deep="'+list[i].area_deep
									+'"><a href="javascript:void(0)">'+list[i].area_name+'</a></div>';
							}
							var all_id = '';
							if( flag!="1" ){
								if( flag == '2' ){
									all_id = one_select_id;
								}else{
									all_id = two_select_id;
								}
								content_html+='<div class="new_pull_left new_w25_ new_pt4 new_pb4 new_city_select_div_content_item" data-area-id="'
									+all_id+'" data-area-name="全部" data-area-parent-id="'
									+all_id+'" data-area-deep="'+flag
									+'"><a href="javascript:void(0)">全部</a></div>';								
							}
							return content_html;							
						},
						three_title_view = function(){
							var select_name = '';
							for(var i=0;i<three_list_area.length;i++){
								if(three_list_area[i].area_id == three_select_id){
									select_name = three_list_area[i].area_name;
									break;
								}
							}
							if(!select_name){
								select_name = '请选择';
							}
							$("#new_city_selct_div_tab_three_font").html(select_name);								
						},						
						three_view = function(){
							three_title_view();
							$("#new_city_select_div_content_three").html(get_view_html(three_list_area,'3'));							
						},
						two_title_view = function(){
							var select_name = '';
							for(var i=0;i<two_list_area.length;i++){
								if(two_list_area[i].area_id == two_select_id){
									select_name = two_list_area[i].area_name;
									break;
								}
							}
							if(!select_name){
								select_name = '请选择';
							}
							$("#new_city_selct_div_tab_two_font").html(select_name);							
						},
						two_view = function(){
							two_title_view();
							$("#new_city_select_div_content_two").html(get_view_html(two_list_area,'2'));							
						},	
						one_title_view = function(){
							var select_name = '';
							for(var i=0;i<one_list_area.length;i++){
								if(one_list_area[i].area_id == one_select_id){
									select_name = one_list_area[i].area_name;
									break;
								}
							}
							if(!select_name){
								select_name = '请选择';
							}
							$("#new_city_selct_div_tab_one_font").html(select_name);							
						},					
						one_view = function(){
							one_title_view();
							$("#new_city_select_div_content_one").html(get_view_html(one_list_area,'1'));
						},
						init = function(){
							for(var i=0;i<list_area.length;i++){
								var area_deep = list_area[i].area_deep.toString();
								switch (area_deep){
									case '1':
										one_list_area.push(list_area[i]);
										break;
									case '2':
										two_list_area.push(list_area[i]);
										break;
									case '3':
										three_list_area.push(list_area[i]);
										break;
									default:
										break;
								}
							}
							if(return_area_id){
								var array = [];
								array.push(return_area_id);
								var fun = function(new_return_area_id,area_deep){
									if(area_deep == 0){
										return ;
									}
									if(area_deep == -1){
										for(var i=0;i<list_area.length;i++){
											if(new_return_area_id == list_area[i].area_id){
												area_deep = list_area[i].area_deep;
												break;
											}
										}											
									}
									for(var i=0;i<list_area.length;i++){
										if(new_return_area_id == list_area[i].area_id){
											new_return_area_id = list_area[i].area_parent_id;
											break;
										}
									}	
									array.push(new_return_area_id);
									fun(new_return_area_id,new Number(area_deep)-1);
								}
								fun(return_area_id,-1);
								console.log(array);
								var length = array.length;
								switch (length+''){
									case '4':
										three_select_id = array[0];
										two_select_id = array[1];
										one_select_id = array[2];
										break;
									case '3':
										two_select_id = array[0];
										one_select_id = array[1];									
										break;
									case '2':
										one_select_id = array[0];										
										break;
									default:
										break;
								}
								one_view();
								two_view();
								three_view();
								show_result(true);
							}else{
								one_view();	
							}
						},
						new_city_select_div_tab_one_click = function(){
							$(".new_city_select_div_tab_item").removeClass('active');
							$('#new_city_select_div_tab_one').addClass('active');
							$(".new_city_select_div_content > div").removeClass('active');
							$("#new_city_select_div_content_one").addClass('active');							
						},
						new_city_select_div_tab_two_click = function(){
							$(".new_city_select_div_tab_item").removeClass('active');
							$('#new_city_select_div_tab_two').addClass('active');							
							$(".new_city_select_div_content > div").removeClass('active');
							$("#new_city_select_div_content_two").addClass('active');							
						},
						new_city_select_div_tab_three_click = function(){
							$(".new_city_select_div_tab_item").removeClass('active');
							$('#new_city_select_div_tab_three').addClass('active');		
							$(".new_city_select_div_content > div").removeClass('active');
							$("#new_city_select_div_content_three").addClass('active');								
						},
						show_result = function(flag){
							var one_select_name = $("#new_city_selct_div_tab_one_font").html(),
								two_select_name = $("#new_city_selct_div_tab_two_font").html(),
								three_select_name = $("#new_city_selct_div_tab_three_font").html(),
								result = '';
							if(one_select_name!='请选择' && one_select_name!=''){
								result += one_select_name;
							}	
							if(two_select_name!='请选择' && two_select_name!=''){
								result += two_select_name;
							}	
							if(three_select_name!='请选择' && three_select_name!=''){
								result += three_select_name;
							}					
							$("#new_city_select_result").html(result);
							$("#new_city_select_div").hide();
							if(flag != true){
								var return_area_id = '';
								if(three_select_id!=''){
									return_area_id = three_select_id;
								}else if(two_select_id!=''){
									return_area_id = two_select_id;
								}else{
									return_area_id = one_select_id;
								}
								$url = "{:url('index/store/index',['store_id'=>$store_id])}?area_id=" + return_area_id;
							    location.href = $url;
							}										
						},
						is_no_next = function(flag){
							var result = true;
							switch (flag){
								case '1':
									for(var i=0;i<two_list_area.length;i++){
										if(two_list_area[i].area_parent_id == one_select_id){
											result = false;
											break;
										}
									}
									break;
								case '2':
									for(var i=0;i<three_list_area.length;i++){
										if(three_list_area[i].area_parent_id == two_select_id){
											result = false;
											break;
										}
									}
									break;
								default:
									break;
							}
							return result;
						};											
						init();
						$("#new_city_select_all_div").mouseenter(function(){
							if($("#new_city_select_div").css('display') == 'none'){
								$("#new_city_select_div").show();
								new_city_select_div_tab_one_click();								
							}
						}).mouseleave(function(){
							if(is_clicked == false){
								$("#new_city_select_div").hide();
							}
						});	
						$("#new_city_select_close_div").click(function(){
							$("#new_city_select_div").hide();
						});			
						$(document).on('click','body .new_city_select_div_content_item',function(){
							is_clicked = true;
							var $this = $(this);
							var 	obj = {
								'area_id':$this.attr('data-area-id'), 
								'area_name':$this.attr('data-area-name'), 
								'area_parent_id':$this.attr('data-area-parent-id'), 
								'area_sort':$this.attr('data-area-sort'), 
								'area_deep':$this.attr('data-area-deep') 
							};
							switch (obj.area_deep){
								case '1':
									var is_two = false,
										is_three = false;
									for(var i=0;i<two_list_area.length;i++){
										if(two_list_area[i].area_parent_id == obj.area_id && two_list_area[i].area_id == two_select_id){
											is_two = true;
											break;
										}
									}
									if(is_two == true){
										for(var i=0;i<three_list_area.length;i++){
											if(three_list_area[i].area_parent_id == two_select_id && three_list_area[i].area_id == three_select_id){
												is_three = true;
												break;
											}
										}	
									}
									if(is_two == true){
										if(is_three == true){
										}else{
											three_select_id = '';
										}
									}else{
										two_select_id = '';
										three_select_id = '';
									}
									one_select_id = obj.area_id;
									one_title_view();		
									two_title_view();
									three_title_view();
									two_view();
									new_city_select_div_tab_two_click();	
									if(is_no_next('1') == true){
										show_result();
									}
									break;
								case '2':
									two_select_id = obj.area_id;
									two_title_view();			
									var is_three = false;
										for(var i=0;i<three_list_area.length;i++){
											if(three_list_area[i].area_parent_id == two_select_id){
												is_three = true;
												break;
											}
										}
									three_view();
									new_city_select_div_tab_three_click();	
									if(is_no_next('2') == true){
										show_result();
									}																						
									break;
								case '3':
									three_select_id = obj.area_id;
									three_title_view();	
									show_result();						
									break;
								default:
									break;
							}
						});
						$("#new_city_select_div_tab_one").click(function(){
							new_city_select_div_tab_one_click();
						});						
						$("#new_city_select_div_tab_two").click(function(){
							new_city_select_div_tab_two_click();							
						});						
						$("#new_city_select_div_tab_three").click(function(){
							new_city_select_div_tab_three_click();											
						});
						
					
				})();
			</script>					
<script src="/old/data/resource/js/waypoints.js?{$Think.config.version_source}"></script>
<script src="/old/shop/resource/js/search_category_menu.js?{$Think.config.version_source}"></script>
<script type="text/javascript">
var defaultSmallGoodsImage = '{:img_url("")}';
var defaultTinyGoodsImage = '{:img_url("")}';

$(function(){
    $('#files').tree({
        expanded: 'li:lt(2)'
    });

    $('#main-nav-holder').waypoint(function(event, direction) {
        $(this).parent().toggleClass('sticky', direction === "down");
        event.stopPropagation();
    });
	$('span[nc_type="show"]').click(function(){
		s = $(this).parents('dd').prev().find('li[nc_type="none"]');
		if(s.css('display') == 'none'){
			s.show();
			$(this).html('<i class="icon-angle-up"></i>收起');
		}else{
			s.hide();
			$(this).html('<i class="icon-angle-down"></i>更多');
		}
	});

/* 	<?php if(isset($_GET['area_id']) && intval($_GET['area_id']) > 0){?>
  		$('[nc_type="area_name"]').html('<?php echo $output['province_array'][intval($_GET['area_id'])]; ?>');
	<?php }?> */
	$('#nchSidebarViewed').perfectScrollbar();
});
</script>
{/block}